import Vue from 'vue'
import VueRouter from 'vue-router'
Vue.use(VueRouter)

// 导入相关的页面
import Login from '@/views/Login'
import Layout from '@/views/Layout'
import Employee from '@/views/Employee'
import Salary from '@/views/Salary'
import Axios from '@/views/Axios'
import Parent from '@/views/Vuex-Base/Parent'
import ModuleParent from '@/views/Vuex-Module/Parent'
import MapParent from '@/views/Vuex-Map/Parent'
import NotFound from '@/views/NotFound'

const router = new VueRouter({
  // mode: 'hash', // 不写默认就是hash模式
  routes: [
    {
      path: '/login',
      component: Login
    },
    {
      path: '/layout',
      component: Layout,
      children: [
        {
          path: 'employee',
          component: Employee
        },
        {
          path: 'salary',
          component: Salary
        }
      ]
    },
    {
      path: '/',
      redirect: '/login'
    },
    {
      path: '/axios',
      component: Axios
    },
    {
      path: '/vuex-base',
      component: Parent
    },
    {
      path: '/vuex-module',
      component: ModuleParent
    },
    {
      path: '/vuex-map',
      component: MapParent
    },
    {
      path: '*',
      component: NotFound
    }
  ]
})

export default router
